<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>专属定制瓶，情谊6人传</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <link href="http://66xiaoqu.babytreeimg.com/css/inviteReward/coco.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="wrapper">
    <div class="part1">
        <img src="http://66xiaoqu.babytreeimg.com/images/inviteReward/coco_bg.jpg">
        <span class="top_btn" id="top_bt" onclick="toInvitePage()"></span>

        <p class="rule-p"><a href="javascript:;" class="rule-a">猛戳查看详情<img
                src="http://66xiaoqu.babytreeimg.com/images/inviteReward/rule-irrow.png"></a></p>
    </div>
    <div class="rule-con">
        <div class="rule-t"><span>活动规则</span></div>
        <ul class="rule-ul">
            <li><em>1</em>

                <p>活动期间邀请5位好亲好友好邻居加入66，组成6人团。即可获得6个专属你们的定制可乐瓶（印有不同搞笑动情见面语），由你分发给大家啦！</p></li>
            <li><em>2</em>

                <p>活动有效时间：即日起至12.13日24：00，只要好友通过你的邀请在这段时间内下载注册成功即可。（“我—邀请有礼—邀请进度”里可查询）</p></li>
            <li><em>3</em>

                <p>活动结束12.14日小6将会私信联系参与用户的快递地址和定制姓名，一周后寄出定制瓶给参与用户。</p></li>
            <li><em>4</em>

                <p>本活动限上海地区用户参与，敬请谅解。</p></li>
            <li><em>5</em>

                <p>活动与可口可乐公司无关，最终解释权归66小区所有。任何刷榜刷单行为都会被取消参与资格，并被小6永久拉黑哟。</p></li>
        </ul>

        <ul class="btn">
            <li onclick="toInvitePage()"><span id="item_1">我要定制瓶</span></li>
            <li onclick="share()"><img
                    src="http://66xiaoqu.babytreeimg.com/images/inviteReward/share_icon.png"><span class="share">分享</span>
            </li>
        </ul>

        <!--<a href="javascript:;" class="btn" onclick="toInvitePage()">开始情谊传递</a>-->
        <img src="http://66xiaoqu.babytreeimg.com/images/inviteReward/pic.png" class="pic">
    </div>
</div>

<div class="pop" id="pop" onclick="popClick()">
    <img src="http://66xiaoqu.babytreeimg.com/images/inviteReward/pop.png">
</div>

</body>
</html>
<script src="http://66xiaoqu.babytreeimg.com/js/controller/acquisition.js"></script>
<script src="http://66xiaoqu.babytreeimg.com/js/lib/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="http://66xiaoqu.babytreeimg.com/js/controller/common.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="http://66xiaoqu.babytreeimg.com/js/controller/share.js"></script>
<script>
    $(window).load(function () {
        var showpop = true;
        $('.rule-a').click(function () {
            if (showpop) {
                $('.rule-con').show();
                var scrollTop = 0;
                var conH = $('.rule-con').offset().top

                var time = setInterval(function () {
                    scrollTop = scrollTop + 40;
                    $('#wrapper').scrollTop(scrollTop);
                    if (scrollTop >= conH) {
                        $('#wrapper').scrollTop(conH);
                        clearInterval(time);
                    }
                }, 15);
                showpop = false;
            } else {
                $('.rule-con').hide();
                showpop = true;
            }
            $(this).toggleClass('rule-click');

        });
    });

    var ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
        var shareData = {
            title: '送上专属定制瓶，请5位好友喝可乐。',
            desc: '钦点5个最想见的好友，创造你们的专属定制瓶',
            imgUrl: 'http://66xiaoqu.babytreeimg.com/app/images/inviteReward/share.jpg',
            link: 'http://' + window.location.host + '/app/inviteReward/coco.html?type=out'
        };

        wx.ready(function () {
            wx.onMenuShareAppMessage({
                title: shareData.title,
                link: shareData.link,
                imgUrl: shareData.imgUrl,
                desc: shareData.desc,
                success: function () {
                    //showResult();
                    clickAcquisition({type: 69, typeDesc: '可乐微信分享成功'});
                }
            });
            wx.onMenuShareTimeline({
                title: shareData.title,
                link: shareData.link,
                imgUrl: shareData.imgUrl,
                success: function () {
                    //showResult();
                    clickAcquisition({type: 69, typeDesc: '可乐微信分享成功'});
                }
            });
            wx.onMenuShareQQ(shareData);
            wx.onMenuShareWeibo(shareData);
        });

        $.post('http://weixin-66xiaoqu.babytree.com/wxJs/getWxJsConfig.do', function (json) {
            timestamp = json.data.timestamp;
            appId = json.data.appId;
            nonceStr = json.data.nonceStr;
            signature = json.data.signature;
            shareT(appId, timestamp, nonceStr, signature);
        }, 'json');

        function shareT(appId, timestamp, nonceStr, signature) {
            wx.config({
                debug: false,
                appId: appId,
                timestamp: timestamp,      //生成签名的时间戳
                nonceStr: nonceStr,       //生成签名的随机串
                signature: signature,     //签名
                jsApiList: [
                    'checkJsApi',
                    'onMenuShareTimeline',
                    'onMenuShareAppMessage',
                    'onMenuShareQQ',
                    'onMenuShareWeibo'
                ]
            });
        }
    }

    var params = {};
    var tempArray = window.location.search.split('?');
    if (tempArray.length == 2) {
        var parts = tempArray[1].split('&');
        for (var i = 0; i < parts.length; i++) {
            var nv = parts[i].split('=');
            if (!nv[0]) continue;
            params[nv[0]] = nv[1] || true;
        }
    }

    if (params.type == 'out') {
        document.getElementById('item_1').innerText = '我要定制瓶';
        document.getElementById('top_bt').innerHTML = '我要定制瓶';
    } else {
        document.getElementById('item_1').innerHTML = '开始传递情谊';
        document.getElementById('top_bt').innerHTML = '开始传递情谊';
    }

    function share() {
        if (params.type == 'out') {
            $('#pop').css({top: $(document).scrollTop()});

            $('#wrapper').css({overflow: 'hidden'});
            document.getElementById('pop').style.display = 'block';

            clickAcquisition({
                type: 67,
                typeDesc: '可乐站外点击分享'
            });

        } else {

            clickAcquisition({
                type: 66,
                typeDesc: '可乐站内点击分享'
            });

            var title = '送上专属定制瓶，请5位好友喝可乐。';
            var desc = '钦点5个最想见的好友，创造你们的专属定制瓶';
            var imageURL = 'http://66xiaoqu.babytreeimg.com/app/images/inviteReward/share.jpg';
            var url = 'http://' + window.location.host + '/app/inviteReward/coco.html?type=out';

            if (params.type == 'ios') {
                document.location.href = "66xiaoqu:market:share##title=" + title + "&nbsp;desc=" + desc + "&nbsp;image=" + imageURL + "&nbsp;url=" + url;
            } else {
                webviewhandle.shareGoodsDetail(title, desc, imageURL, url);//webviewhandle为webview注册对象
            }
        }
    }

    function popClick() {
        $('#wrapper').css({overflow: 'auto'});
        document.getElementById('pop').style.display = 'none';
    }

    function toInvitePage() {
        if (params.type == 'out') {
            clickAcquisition({
                type: 68,
                typeDesc: '可乐站外点击下载'
            });

            toDownload();
        } else {
            var postData = {
                type: 64,
                typeDesc: '可乐活动开始情谊传递'
            };
            clickAcquisition(postData);

            if (params.type == 'ios') {
                document.location.href = "66xiaoqu:toInvitePage##userId=" + params.token;
            } else {
                webviewhandle.goToInvitePage(params.token);//webviewhandle为webview注册对象
            }
        }
    }
</script>